package tema8.ej05.controller;

import java.io.IOException;

import javax.servlet.ServletException;
import javax.servlet.annotation.WebServlet;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

import tema8.ej05.model.PaisDAO;
import tema8.ej05.model.bo.Pais;

@WebServlet("/PaisCrear")
public class PaisCrearController extends HttpServlet {
	private static final long serialVersionUID = 1L;

	protected void doGet(HttpServletRequest request,
			HttpServletResponse response) throws ServletException, IOException {
		request.getRequestDispatcher("/tema8/ej05/paisCrear.jsp").forward(
				request, response);
	}

	protected void doPost(HttpServletRequest request,
			HttpServletResponse response) throws ServletException, IOException {
		PaisDAO paisDAO = new PaisDAO();
		Pais pais = new Pais(request.getParameter("nombre"));
		paisDAO.crearPais(pais);
		request.getRequestDispatcher("/PaisRecuperar").forward(
				request, response);
		
	}
}
